﻿using System;
using System.Linq;
using System.Threading.Tasks;
using Quartz;
using SportsPlatform.Core.Model.SportBusiness;
using SportsPlatform.Dto.SportBusiness.Competition;
using SportsPlatform.Global;
using SportsPlatform.Repository.CoreEntity;
using SportsPlatform.SqlExecuter;

namespace SportsPlatform.Application.QuartzJobs
{
    /// <summary>
    /// 删除日志任务
    /// </summary>
    [DisallowConcurrentExecution]
    public class DeleteLogJob : IJob
    {
        private readonly ISqlExecuterRepository _sqlExecuterRepository;

        public DeleteLogJob()
        {
            _sqlExecuterRepository = new SqlExecuterRepository();
        }

        public async Task Execute(IJobExecutionContext context)
        {
            string strSQL = "DELETE FROM T_B_ClientLog WHERE OperationTime<=" + $"{DateTime.Now.AddMonths(-3)}";
            var res = _sqlExecuterRepository.Execute(strSQL, null);
        }
    }
}

